package uk.ac.cam.cl.projectcharlie2010.camera;

import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;

import uk.ac.cam.cl.projectcharlie2010.game.player.physical.AbortedException;
import uk.ac.cam.cl.projectcharlie2010.game.player.physical.ImpossibleMoveException;

import ch.nostromo.tiffanys.game.move.MoveInput;

public class CameraTester {

	public static void main(String[] args) {
		Camera cam = Camera.getInstance();
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		System.out.println("Ready to calibrate. Type YES to calibrate");
		try{
			String calibrate = reader.readLine();
			if (calibrate.equals("YES")) {
				cam.updateBackgroundCeiling();
				System.out.println("Calibration complete");
			}
		}catch(Exception e){}	

		while(true){
			System.out.println("Press enter when ready to start move.");
			try {
				reader.readLine();
				System.out.println("Perform move.");
				MoveInput move = cam.seeNextMove();
				System.out.println("Move completed, from "+move.getFrom()+" to "+move.getTo());
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}


	}
}
